package corsi.jpa.demo.prima.servizi;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.apache.log4j.Logger;
import org.apache.log4j.lf5.viewer.LogFactor5Dialog;
import org.apache.log4j.spi.LoggerFactory;

public class ServiceLocator {

	private static Logger logger = Logger.getLogger(ServiceLocator.class);

	public static EntityManagerFactory factory;
	
	static{
		
		factory = Persistence.createEntityManagerFactory("JSEUnit");		
		logger.info("EntityManagerFactory creata "+factory.toString());
	}
	
	public static EntityManager getEntityManager(){
		EntityManager em = factory.createEntityManager();
		return em;
	}
}
